import numpy as np
import random
import time

# 最终距离的数组时间跨度比较大，因为速度最慢
# 从开始到最终距离都用first_t,等到滑过了目标距离的second_distance后
# 设置初始位置、初始速度、时间间隔
# start, v0, t = 1166, 1.25, 0.8
# 首先在原地停留一秒多左右
# 速度平均在 0.125 - 
# 8 - 20
# 到了最终距离以后停留了一秒钟往回滑动
# 第一次减速在second_distance，然后再终点停留了一下，大约三百毫秒，然后开始加速，接着减速
#s = 1,
def get_tracks(distance):
    trace = []
    t = int(time.time()*1000)
    trace.append(["1137","342",t])
    trace.append(["1166","369",t])
    t = t+random.randint(100,200)
    trace.append(['1167','369',t])
    distance = distance - 1
    x = random.randint(0,10)#随机数，让时间翻倍
    base_x = 1167
    move = 0
    while distance > 0:
        move = move + 1   
        if move == x:
            t = t + 16
            trace.append([base_x+move,'369',t])
            distance = distance - 1
            x = x + random.randint(0,10)
            continue
        if distance < 4:
            t = t + random.randint(30,300)
            trace.append([base_x+move,'371',t])
            distance = distance - 1 
        t = t + 8
        trace.append([base_x+move,'369',t])
        distance = distance -1
    trace.append([trace[-1][0],'371',trace[-1][2] + random.randint(500,7000)])
    return trace

if __name__ == "__main__":
    z = get_tracks(67)
    print(z)